package com.itboye.shop.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SpinnerAdapter;
import android.widget.TextView;

import com.itboye.shop.R;
import com.itboye.shop.bean.BankCodeBean;

import java.util.List;

/**
 * Created by Itboye-000018 on 2017/1/13.
 */

public class SpingAdapter03 extends android.widget.BaseAdapter implements SpinnerAdapter {
    List<BankCodeBean> beans;
    Context context;
    public SpingAdapter03(List<BankCodeBean> beans, Context context){
        this.beans=beans;
        this.context=context;
    }
    @Override
    public int getCount() {
        return beans.size();
    }

    @Override
    public Object getItem(int position) {
        return beans.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHouder houder;
        if(convertView==null){
            houder=new ViewHouder();
            convertView= LayoutInflater.from(context).inflate(R.layout.sping_item,null);
            houder.name= (TextView) convertView.findViewById(R.id.spingName);
            convertView.setTag(houder);
        }else{
            houder= (ViewHouder) convertView.getTag();
        }
        houder.name.setText(beans.get(position).getName());

        return convertView;
    }
    class ViewHouder{
        private TextView name;
    }
}
